﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminPanel/AdminSite.Master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="FastTrackCabService.AdminPanel.Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="../Style/Supervisors.css" rel="stylesheet" type="text/css"/>
    <style>
        .select {
            -ms-border-radius: 0.5em;
            border-radius: 0.5em;
            outline: none;
            padding: 0.5em;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <table style="margin: 1.5em auto;">
                <tr>
                    <td>
                        <div class="searchBox" style="float: left; margin-left: 0.5em;">
                            <asp:TextBox ID="tbSearch" runat="server" min="1" placeholder="Search by booking id" CssClass="myTextBox"
                                         TextMode="Number">
                            </asp:TextBox>
                            <asp:ImageButton ID="ibtnSearch" OnClick="ibtnSearch_OnClick" runat="server" ImageUrl="~/Images/magnifying_glass_icon.png">
                            </asp:ImageButton>
                        </div>
                        <div style="color: gray; float: left; margin-left: 1em;">
                            Show
                            <asp:DropDownList ID="ddlType" CssClass="select" OnSelectedIndexChanged="ddlStatus_OnSelectedIndexChanged"
                                              AutoPostBack="True" runat="server">
                                <asp:ListItem>All</asp:ListItem>
                                <asp:ListItem>PICK</asp:ListItem>
                                <asp:ListItem>PICK & DROP</asp:ListItem>
                            </asp:DropDownList>
                            bookings
                        </div>
                        <div style="color: gray; float: left; margin-left: 5px;">
                            where status is
                            <asp:DropDownList ID="ddlStatus" CssClass="select" OnSelectedIndexChanged="ddlStatus_OnSelectedIndexChanged"
                                              AutoPostBack="True" runat="server">
                                <asp:ListItem>All</asp:ListItem>
                                <asp:ListItem>Pending</asp:ListItem>
                                <asp:ListItem>Cancelled</asp:ListItem>
                                <asp:ListItem>Rejected</asp:ListItem>
                                <asp:ListItem>Approved</asp:ListItem>
                                <asp:ListItem>OnProgress</asp:ListItem>
                                <asp:ListItem>Settled</asp:ListItem>
                            </asp:DropDownList>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:GridView ID="gvBookings" CssClass="supervisors" style="margin: 0 0.5em;" runat="server" CellPadding="4"
                                      ForeColor="#333333" GridLines="None" AllowPaging="True" OnPageIndexChanging="gvBookings_OnPageIndexChanging"
                                      AutoGenerateColumns="False">
                            <AlternatingRowStyle BackColor="White" ForeColor="#284775"/>
                            <Columns>
                                <asp:BoundField DataField="BookingId" HeaderText="Id">
                                    <HeaderStyle Width="50px"/>
                                </asp:BoundField>
                                <asp:BoundField DataField="CustomerId" HeaderText="Customer Id">
                                    <HeaderStyle Width="70px"/>
                                </asp:BoundField>
                                <asp:BoundField DataField="Type" HeaderText="Type">
                                    <HeaderStyle Width="70px"/>
                                </asp:BoundField>
                                <asp:BoundField DataField="BookedDateTime" HeaderText="Booked date & time">
                                    <HeaderStyle Width="100px"/>
                                </asp:BoundField>
                                <asp:BoundField DataField="OriginDateTime" HeaderText="Pickup date & time">
                                    <HeaderStyle Width="100px"/>
                                </asp:BoundField>
                                <asp:BoundField DataField="Status" HeaderText="Status">
                                    <HeaderStyle Width="70px"/>
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="Action">
                                    <ItemTemplate>
                                        <asp:ImageButton ID="ibView" Visible='<%# Eval("Status").ToString() == "Cancelled" || Eval("Status").ToString() == "Rejected" || Eval("Status").ToString() == "Settled" %>'
                                                         ToolTip="View full details" Width="30" PostBackUrl='<%# "BookingFullView.aspx?bookingId=" + Eval("BookingId") %>'
                                                         ImageUrl="../Images/view-black.png" runat="server">
                                        </asp:ImageButton>
                                        <asp:ImageButton ID="ibCheck" Visible='<%# Eval("Status").ToString() == "Pending" %>'
                                                         ToolTip="Check for confirmation" Width="30" PostBackUrl='<%# "ConfirmBooking.aspx?bookingId=" + Eval("BookingId") %>'
                                                         ImageUrl="../Images/check_for_confirm.png" runat="server">
                                        </asp:ImageButton>
                                        <asp:ImageButton ID="ImageButton1" style="width: 25px;" Visible='<%# Eval("Status").ToString() == "Approved" %>'
                                                         ToolTip="Execute this booking" Width="30" PostBackUrl='<%# "StartBooking.aspx?bookingId=" + Eval("BookingId") %>'
                                                         ImageUrl="../Images/start_32.png" runat="server">
                                        </asp:ImageButton>
                                        <asp:ImageButton ID="ibSettle" Visible='<%# Eval("Status").ToString() == "OnProgress" %>'
                                                         ToolTip="Complete or settle the booking" Width="30" PostBackUrl='<%# "SettleBooking.aspx?bookingId=" + Eval("BookingId") %>'
                                                         ImageUrl="../Images/Complete_Symbol.png" runat="server">
                                        </asp:ImageButton>
                                        <asp:ImageButton ID="ibDelete" Visible='<%# Eval("Status").ToString() == "Pending" || Eval("Status").ToString() == "Approved" %>'
                                                         OnClientClick=" if (!confirm('Are you sure do you want to reject this booking?')) return false; " OnClick="ibDelete_OnClick"
                                                         ToolTip="Reject this booking" PostBackUrl='<%# "?bookingId=" + Eval("BookingId") %>'
                                                         ImageUrl="../Images/abort.png" runat="server"/>
                                    </ItemTemplate>
                                    <HeaderStyle Width="70px"/>
                                </asp:TemplateField>
                            </Columns>
                            <EmptyDataRowStyle CssClass="emptyDataRow"></EmptyDataRowStyle>
                            <EmptyDataTemplate>
                                <table class="supervisors" id="ContentPlaceHolder1_gvSupervisors" style="border-collapse: collapse; color: #333333; width: 700px;">
                                    <tr style="background-color: #5D7B9D; color: White; font-weight: bold;">
                                        <th scope="col">
                                            Id
                                        </th>
                                        <th scope="col">
                                            CustomerId
                                        </th>
                                        <th scope="col">
                                            Type
                                        </th>
                                        <th scope="col">
                                            Booked date & time
                                        </th>
                                        <th scope="col">
                                            Pickup date & time
                                        </th>
                                        <th scope="col">
                                            Status
                                        </th>
                                        <th scope="col">
                                            Action
                                        </th>
                                    </tr>
                                    <tr style="background-color: #F7F6F3; color: #333333;">
                                        <td colspan="7" style="padding: 0.5em;">
                                            NO BOOKING AVAILABLE
                                        </td>
                                    </tr>
                                </table>
                            </EmptyDataTemplate>
                            <EditRowStyle BackColor="#999999"/>
                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"/>
                            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"/>
                            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center"/>
                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333"/>
                            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333"/>
                            <SortedAscendingCellStyle BackColor="#E9E7E2"/>
                            <SortedAscendingHeaderStyle BackColor="#506C8C"/>
                            <SortedDescendingCellStyle BackColor="#FFFDF8"/>
                            <SortedDescendingHeaderStyle BackColor="#6F8DAE"/>
                        </asp:GridView>
                    </td>
                </tr>
            </table>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>